/*
 * Copyright (c) 2023, 2024,yzc.cn All rights reserved.
 *
 */
package com.by.config;


import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import org.springframework.web.servlet.config.annotation.EnableWebMvc;
import springfox.documentation.builders.ApiInfoBuilder;
import springfox.documentation.builders.PathSelectors;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.service.ApiInfo;
import springfox.documentation.service.Contact;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger2.annotations.EnableSwagger2;

/**
 * <p>Project: erp-cloud-api - SwaggerConfig</p>
 * <p>Powered by yzc On 2024-01-08 20:55:50</p>
 * <p>描述：<p>
 *
 * @author yzc [yzc0415@126.com]
 * @version 1.0
 * @since 17
 */
@Configuration
public class SwaggerConfig {
    @Bean
    public Docket createDocket() {
        return new Docket(DocumentationType.SWAGGER_2)
                .apiInfo(getApiInfo())
                //.enable(true)//为true可以访问 false不能访问
                .select()
                .apis(RequestHandlerSelectors.basePackage("com.by.controller"))//指定控制类的基础包
                .paths(PathSelectors.ant("/v1/**"))//匹配所有的路径
                .build();
    }

    private ApiInfo getApiInfo() {
        return new ApiInfoBuilder()
                .title("ERP-采购管理系统")
                .description("ERP-采购管理系统的接口文档，里面包含了所有的请求及参数信息")
                .contact(new Contact("誰说柚子不酸", "http://localhost", "1524059518@qq.com"))
                .version("v1.0")
                .build();
    }


}
